from app.config.config import config
from app.settings import env
from sqlalchemy import create_engine
from sqlalchemy.orm import Session, declarative_base

def db_connect():
  """
  数据库连接
  return engine, session, Base
  """
  db_url = config[env].db_url
  echo = config[env].if_echo
  engine = create_engine(db_url, echo=echo)
  session = Session(engine)
  Base = declarative_base()
  return engine, session, Base